﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Mofang.Utils.LogProvider
{
	/// <summary>
	/// 普通日志
	/// </summary>
	public interface ICommonLog
	{
		string Id { get; set; }

		int Type { get; set; }

		string Operation { get; set; }

		string Message { get; set; }

		bool IsSuccess { get; set; }

		string UserId { get; set; }

		string UserName { get; set; }

		string RelationId { get; set; }

		string OrgId { get; set; }

		string Client { get; set; }

		string Server { get; set; }

		DateTime Created { get; set; }
	}
	/// <summary>
	/// 普通日志
	/// </summary>
	public class CommonLog:ICommonLog
	{
        public CommonLog()
        {

        }
        /// <summary>
        /// 生成日志
        /// </summary>
        /// <param name="log"></param>
        /// <param name="operation"></param>
        public CommonLog(LogModel log,string operation)
		{
			Id = SerialProvider.CreateID();
			Type = log.Type ;
			Operation = operation;
			Message = log.Message;
			IsSuccess = log.IsSuccess;
			UserId = log.UserId;
			UserName = log.UserName;
			RelationId = log.RelationId;
			OrgId = log.OrgId;
			Client = log.Client;
			Server = log.Server;
			Created = DateTime.Now;
		}

		public string Id { get; set; }

		public int Type { get; set; }

		public string Operation { get; set; }

		public string Message { get; set; }

		public bool IsSuccess { get; set; }

		public string UserId{get;set;}

		public string UserName { get; set; }

		public string RelationId { get; set; }

		public string OrgId { get; set; }

		public string Client { get; set; }

		public string Server { get; set; }

		public DateTime Created { get; set; }
	}
}
